home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / sources.exe / BRIEF / SCHEME.CB < prev    next >
Encoding:
Text File  |  1993-10-10  |  17.4 KB  |  793 lines

  1. /* SCHEME.CB
  2.  ************************************************************************
  3.  *                                    *
  4.  *        PC Scheme/Geneva 4.00 CBrief code            *
  5.  *                                    *
  6.  * (c) 1985-1988 by Texas Instruments, Inc. See COPYRIGHT.TXT        *
  7.  * (c) 1992 by L. Bartholdi & M. Vuilleumier, University of Geneva    *
  8.  *                                    *
  9.  *----------------------------------------------------------------------*
  10.  *                                    *
  11.  *                Brief Support                *
  12.  *                                    *
  13.  *----------------------------------------------------------------------*
  14.  *                                    *
  15.  * Created by: Larry Bartholdi        Date: 1992            *
  16.  * Revision history:                            *
  17.  * - 18 Jun 92:    Renaissance (Borland Compilers, ...)            *
  18.  *                                    *
  19.  *                    ``In nomine omnipotentii dei''    *
  20.  ************************************************************************/
  21.  
  22. #include    <dialog.h>
  23.  
  24. #define    SIMPLEINDENT    2        // in (dummy
  25.                     //    ..(xxx))
  26. #define    COMPLETENAME    (inq_environment("BSCHEME")+"SCHEME.CMP")
  27. #define    TRANSITNAME    (inq_environment("BSCHEME")+"SCHEME.TMP")
  28. #define    MINMENU    15
  29. #define    MAXMENU    30
  30. #define    COMMENTPOS    49
  31.  
  32. int    s_completion;
  33. int    s_mode;
  34. string    s_tokens;
  35.  
  36. /************************************************************************
  37.  * Initialise the scheme package                    *
  38.  ************************************************************************/
  39. void    .s()
  40. {
  41.     string    whoami;
  42.  
  43.     keyboard_push();
  44.     assign_to_key("<Enter>","s_enter");
  45.     assign_to_key("<Ctrl-h>", "s_help");
  46.     assign_to_key(")","s_paren");
  47.     assign_to_key(";","s_semi");
  48.     assign_to_key("<Tab>","s_tab");
  49.     assign_to_key("<Shift-Tab>","s_comment");
  50.     assign_to_key("<Ctrl-G>","s_list_proc");
  51.     assign_to_key("<Ctrl-A>","s_mark_near");
  52.     assign_to_key("<Ctrl-Z>","s_mark_far");
  53.     assign_to_key("<Alt-F10>","s_eval_all");
  54.     assign_to_key("<Ctrl-F10>","s_eval_mark");
  55.     assign_to_key("<Ctrl-Left>","s_prev");
  56.     assign_to_key("<Ctrl-Right>","s_next");
  57.     assign_to_key("<Ctrl-F1>","s_toggle");
  58.  
  59.     use_local_keyboard(inq_keyboard());
  60.     keyboard_pop(1);
  61.  
  62.     tabs( 9, 17 );
  63.  
  64.             // neat bug in CBRIEF: the system would crash
  65.             // were this written as 's_tokens = ".." + "..";'
  66.     s_tokens = " ";
  67.     s_tokens = s_tokens + "DEFINE DEFINE-INTEGRABLE SET! LAMBDA NAMED-LAMBDA REC ";
  68.     s_tokens = s_tokens + "LET LETREC LET* FLUID-LET ";
  69.     s_tokens = s_tokens + "MACRO CALL/CC CASE WHEN APPLY-IF ";
  70.     s_tokens = s_tokens + "WITH-INPUT-FROM-FILE CALL-WITH-INPUT-FILE AUTOLOAD-FROM-FILE ";
  71.     s_tokens = s_tokens + "WITH-OUTPUT-TO-FILE CALL-WITH-OUTPUT-FILE ";
  72.             // these always get indented by SIMPLEINDENT
  73.     inq_names( whoami );
  74.     message("File: %s [PCS package]", whoami );
  75. }
  76.  
  77. void    .sw()
  78. {
  79.     global int    s_use_sw;
  80.  
  81.     if( first_time() )
  82.         s_use_sw = inq_macro(".sw");
  83.     if( s_use_sw )
  84.         .s();
  85. }
  86.  
  87. void    _init(...)
  88. {
  89.     .s();
  90.     s_completion = create_buffer("*completion*", COMPLETENAME, 1 );
  91.     s_mode = 1;
  92.     del( TRANSITNAME );
  93. }
  94.  
  95. /*        Define a mouse event handler to exit from the process if a mouse
  96. **    event occurs.  Save the parameters to pass on to the current handler 
  97. **    after the process exits.
  98. */
  99.  
  100. int    s_recurse;                    //    Flag to tell _invalid_key we're active.
  101. void    s_idlemouse();
  102.  
  103. int     s_mousevent,
  104.         s_parm1,
  105.         s_parm2,
  106.         s_parm3,
  107.         s_parm4;
  108.  
  109. /*
  110. **        s_wait:
  111. **
  112. **        This routine accepts the return code from the search routines and
  113. **    does marking based on that return code.  It can be replaced by the
  114. **    user to modify the marking action.
  115. */
  116.  
  117. void s_wait( int match_length, int countidle, string wait )
  118. {
  119.     if (!inq_kbd_char ())
  120.     {
  121.         drop_anchor ();
  122.         next_char (match_length - 1 - (match_length != 1));
  123.         swap_anchor ();
  124.         keyboard_push ();
  125.  
  126.         s_recurse++;
  127.  
  128.         set_mouse_action( "s_idlemouse" );
  129.         s_mousevent = 0;
  130.  
  131.         if( countidle )
  132.             register_macro (4, "s_wait_idle");
  133.         execute_macro( wait );
  134.         if( countidle )
  135.             unregister_macro (4, "s_wait_idle");
  136.         s_recurse--;
  137.  
  138.         keyboard_pop ();
  139.         raise_anchor ();
  140.  
  141.         if (s_mousevent)
  142.         {
  143.             string mse_handler;
  144.             sprintf(mse_handler, "%s %d %d %d %d", inq_mouse_action(), s_parm1, s_parm2, s_parm3, s_parm4);
  145.             execute_macro(mse_handler);
  146.         }
  147.     }
  148. }
  149.  
  150. /*        This function is called if a mouse event occurs while a pattern is
  151. **    marked after a search. 
  152. */
  153.  
  154. void s_idlemouse(int p1, int p2, int p3, int p4)
  155.     {
  156.     s_parm1 = p1;
  157.     s_parm2 = p2;
  158.     s_parm3 = p3;
  159.     s_parm4 = p4;
  160.     s_mousevent = 1;
  161.     exit();
  162.     }
  163.  
  164. void s_wait_idle ()
  165. {
  166.     if (inq_idle_time ())
  167.         exit ();
  168. }
  169.  
  170. /*
  171. **        _invalid_key:
  172. **
  173. **        This routine is called when an "invalid" key is pressed during normal
  174. **    macro processing.  If the s_recurse variable isn't set, we just
  175. **    call down to the default _invalid_key handler.  Otherwise, we exit the
  176. **    shell process we're in, and allow the keystroke to be processed again.
  177. */
  178.  
  179. void _invalid_key (void)
  180. {
  181.     if (s_recurse)
  182.         exit ();
  183.     else
  184.         _invalid_key ();
  185. }
  186.  
  187. int    s_matchback()
  188. {
  189.     int    count;
  190.  
  191.     while( count >= 0 )
  192.     {
  193.         if( !prev_char() )
  194.             return    FALSE;
  195.         if( !prev_char( 1 + (read(1) == "\\") ) ||
  196.             search_back("[~\\\\]|{\\\\\\\\}[()\"\\|]") <= 0 )
  197.         {
  198.             if( search_back("[()\"\\|]") <= 0 )
  199.                 return    FALSE;
  200.             if( prev_char() )    /* beginning ? */
  201.                 return    TRUE;
  202.         }
  203.         else    next_char( 1 + (read(1) == "\\") );
  204.  
  205.         switch( read(1) )
  206.         {
  207.         case    "(":
  208.             count--;
  209.         case    ")":
  210.             count++;
  211.         case    "\"":
  212.             if( !prev_char(2) )
  213.                 return    FALSE;
  214.             if( search_back("[~\\\\]\"") <= 0 )
  215.                 return    FALSE;
  216.             right();
  217.         case    "|":
  218.             if( !prev_char(2) )
  219.                 return    FALSE;
  220.             if( search_back("[~\\\\]\\|") <= 0 )
  221.                 return    FALSE;
  222.             right();
  223.         }
  224.     }
  225.     return    TRUE;
  226. }
  227.  
  228. int    s_matchfwd()
  229. {
  230.     int    count;
  231.  
  232.     while( count >= 0 )
  233.     {
  234.         if( search_fwd("[~\\\\][()\"\\|]") <= 0 )
  235.             return    FALSE;
  236.         next_char();
  237.  
  238.         switch( read(1) )
  239.         {
  240.         case    "(":
  241.             count++;
  242.         case    ")":
  243.             count--;
  244.         case    "\"":
  245.         {
  246.             int    len;
  247.             if( (len = search_fwd("\"\"|{*[~\\\\]\"}")) <= 0 )
  248.                 return    FALSE;
  249.             next_char( len-2 );
  250.         }
  251.         case    "|":
  252.         {
  253.             int    len;
  254.             if( (len = search_fwd("\\|\\||{*[~\\\\]\\|}")) <= 0 )
  255.                 return    FALSE;
  256.             next_char( len-2 );
  257.         }
  258.         }
  259.     }
  260.     return    TRUE;
  261. }
  262.  
  263. /************************************************************************
  264.  * indent the current line/the marked block                *
  265.  ************************************************************************/
  266. void    s_indent_line()
  267. {
  268.     string    line;
  269.     int    curline, curcol = 1;
  270.  
  271.     move_abs( NULL, 1 );
  272.     line = read();
  273.     line = ltrim( substr( line, 1, strlen(line)-1 ) );
  274.     delete_to_eol();
  275.     save_position();
  276.  
  277.     if( s_matchback() )
  278.     {
  279.         string    buf = trim( read() );
  280.  
  281.         inq_position( NULL, curcol );
  282.     
  283.         if( substr(line,1,1) == ";")
  284.             curcol = 1;        /* never indent comments */
  285.         else
  286.         if( substr(line,1,1) != ")")
  287.         {
  288.             int    i;
  289.  
  290.             if( search_string("(*[( \t]", buf, i ) )
  291.             {
  292.                 if( index( s_tokens, " "+upper(substr(buf,2,i-2))+" ") )
  293.                     curcol += SIMPLEINDENT;
  294.                 else {
  295.                     int    j;
  296.  
  297.                     if( search_string("(*[( \t]+[~ \t]", buf, j ) )
  298.                         i = j - 1;
  299.                     curcol += i - (substr(buf,i,1) == "(");
  300.                 }
  301.             }
  302.             else    curcol += SIMPLEINDENT;
  303.         }
  304.     }
  305.     restore_position();
  306.     move_abs( NULL, curcol );
  307.     insert( line );
  308.     move_abs( NULL, curcol );
  309. }
  310.  
  311. void    s_indent()
  312. {
  313.     if( inq_marked() )
  314.     {
  315.         int    start, startline, end;
  316.         inq_marked( start, startline, end, NULL );
  317.         if( startline > 1 )
  318.             start++;
  319.         save_position();
  320.         while( start <= end )
  321.         {
  322.             move_abs( start++, 1 );
  323.             s_indent_line();
  324.         }
  325.         restore_position();
  326.     }
  327.     else    s_indent_line();
  328. }
  329.  
  330. /************************************************************************
  331.  * close a parenthesis, highlighting the matched (            *
  332.  ************************************************************************/
  333. void    s_parenwait()
  334. {
  335.     refresh();
  336.     process();
  337. }
  338.  
  339. void    s_paren()
  340. {
  341.     int    firstline, line, matchline, col;
  342.  
  343.     insert(")");
  344.     {
  345.         string    l;
  346.         save_position();
  347.         move_abs( NULL, 1 );
  348.         l = read();
  349.         restore_position();
  350.         l = trim( ltrim( substr( l, 1, strlen(l)-1 ) ) );
  351.         if( l == ")")
  352.         {
  353.             s_indent_line();
  354.             right();
  355.         }
  356.     }
  357.  
  358.     inq_position( line, col );
  359.     top_of_window();
  360.     inq_position( firstline );
  361.     move_abs( line, col );
  362.     
  363.     left();
  364.     if( !s_matchback() )
  365.     {
  366.         beep();
  367.         error("No match.");
  368.         move_abs( line, col );
  369.         return;
  370.     }
  371.     inq_position( matchline );
  372.     if( matchline < firstline )
  373.     {
  374.         string    matchtext;
  375.         matchtext = read();
  376.         message( "Line %d: %s", matchline, substr( matchtext, 1, strlen(matchtext) - 1 ) );
  377.     } else    s_wait( 1, 1, "s_parenwait");
  378.  
  379.     move_abs( line, col );
  380. }
  381.  
  382. /************************************************************************
  383.  * Suppress indentation for comments                    *
  384.  ************************************************************************/
  385. void    s_semi()
  386. {
  387.     insert(";");
  388.     {
  389.         string    l;
  390.         save_position();
  391.         move_abs( NULL, 1 );
  392.         l = read();
  393.         restore_position();
  394.         l = trim( ltrim( substr( l, 1, strlen(l)-1 ) ) );
  395.         if( l == ";")
  396.         {
  397.             move_abs( NULL, 1 );
  398.             delete_to_eol();
  399.             insert(";");
  400.         }
  401.     }
  402. }
  403.  
  404. /************************************************************************
  405.  * complete the current word                        *
  406.  ************************************************************************/
  407. string    s_wordstart;
  408.  
  409. void    s_cycletab()
  410. {
  411.     int    buf;
  412.     string    new;
  413.  
  414.     if( inq_marked() )
  415.         delete_block();
  416.     else    raise_anchor();
  417.     drop_anchor(4);
  418.  
  419.     buf = set_buffer( s_completion );
  420.     if( !search_fwd(" "+s_wordstart, 0, 0 ) )
  421.     {
  422.         message("No more completion.");
  423.         move_abs( 1, 1 );
  424.         new = "";
  425.     } else {
  426.         new = read();
  427.         new = substr( new, strlen(s_wordstart)+2, strlen(new)-strlen(s_wordstart)-2 );
  428.         move_rel( 1 );
  429.     }
  430.     set_buffer( buf );
  431.     insert( new );
  432. }
  433.  
  434. void    s_aborttab()
  435. {
  436.     if( inq_marked() )
  437.         delete_block();
  438.     else    raise_anchor();
  439.     drop_anchor(4);
  440.  
  441.     exit();
  442. }
  443.  
  444. void    s_tabwait()
  445. {
  446.     int    end, start, buf;
  447.  
  448.     raise_anchor();        // forget what's been done by s_wait()
  449.     assign_to_key("<Tab>", "s_cycletab");
  450.     assign_to_key("<Esc>", "s_aborttab");
  451.     
  452.     save_position();
  453.     inq_position( NULL, end );
  454.     left();
  455.     search_back("[( \t\n]");
  456.     next_char();
  457.     inq_position( NULL, start );
  458.     if( end > start )
  459.         s_wordstart = read( end - start );
  460.     else    s_wordstart = "";
  461.     restore_position();
  462.  
  463.     buf = set_buffer( s_completion );
  464.     move_abs( 1, 1 );
  465.     set_buffer( buf );
  466.  
  467.     s_cycletab();
  468.     refresh();
  469.     process();
  470. }
  471.  
  472. void    s_tab()
  473. {
  474.     int    col;
  475.  
  476.     if( !s_mode )
  477.     {
  478.         insert("\t");
  479.         return;
  480.     }
  481.     inq_position( NULL, col );
  482.     if( col == 1 || inq_marked() )
  483.         s_indent();
  484.     else {
  485.         string    prev;
  486.         prev_char();
  487.         prev = read(1);
  488.         next_char();
  489.         if( search_string("[ \n\t()\"']", prev ) )
  490.         {
  491.             int    tillend = strlen( ltrim(read()) );
  492.                 /* remember last locus */
  493.             move_abs( NULL, 1 );
  494.             s_indent();
  495.             inq_position( NULL, col );
  496.             {
  497.                 int    newcol;
  498.                 end_of_line();
  499.                 inq_position( NULL, newcol );
  500.                 if( newcol < col )
  501.                     move_abs( NULL, col );
  502.             }
  503.             if( tillend > 0 )
  504.                 move_rel( NULL, 1-tillend );
  505.         } else    s_wait( 1, 0, "s_tabwait");
  506.     }
  507. }
  508.  
  509. /************************************************************************
  510.  * enter a newline, indent the next line                *
  511.  ************************************************************************/
  512. void    s_enter()
  513. {
  514.     insert("\n");
  515.     if( s_mode )
  516.         s_indent_line();
  517. }
  518.  
  519. /************************************************************************
  520.  * tabulate to put a comment                        *
  521.  ************************************************************************/
  522. void    s_comment()
  523. {
  524.     int    col;
  525.  
  526.     end_of_line();
  527.     inq_position( NULL, col );
  528.     if( col < COMMENTPOS )
  529.         while( col < COMMENTPOS )
  530.         {
  531.             insert("\t");    
  532.             inq_position( NULL, col );
  533.         }
  534.     else    insert(" ");
  535.     insert("; ");
  536. }
  537.  
  538. /************************************************************************
  539.  * Initialise marking process                        *
  540.  ************************************************************************/
  541. int    s_mark_start()
  542. {
  543.     save_position();
  544.     while( inq_marked() )
  545.         raise_anchor();
  546.  
  547.     if( read(1) != ")")
  548.     if( !s_matchfwd() )
  549.     {
  550.         error("No match forward.");
  551.         restore_position();
  552.         return    FALSE;
  553.     }
  554.     mark();
  555.     restore_position();
  556.     save_position();
  557.     if( read(1) != "(")
  558.     if( !s_matchback() )
  559.     {
  560.         error("No match backward.");
  561.         restore_position();
  562.         return    FALSE;
  563.     }
  564.     restore_position(0);
  565.     return    TRUE;
  566. }
  567.  
  568. /************************************************************************
  569.  * Extend a mark                            *
  570.  ************************************************************************/
  571. int    s_mark_further()
  572. {
  573.     swap_anchor();
  574.     save_position();
  575.     if( !s_matchfwd() )
  576.     {
  577.         restore_position();
  578.         swap_anchor();
  579.         return    FALSE;
  580.     }
  581.     swap_anchor();
  582.     save_position();
  583.     if( !s_matchback() )
  584.     {
  585.         restore_position();
  586.         swap_anchor();
  587.         restore_position();
  588.         swap_anchor();
  589.         return    FALSE;
  590.     }
  591.     restore_position(0);
  592.     restore_position(0);
  593.     return    TRUE;
  594. }
  595.  
  596. /************************************************************************
  597.  * Mark near parentheses, or extend current mark            *
  598.  ************************************************************************/
  599. void    s_mark_near()
  600. {
  601.     if( inq_marked() )
  602.         s_mark_further();
  603.     else    s_mark_start();
  604. }
  605.  
  606. /************************************************************************
  607.  * Mark far parentheses                            *
  608.  ************************************************************************/
  609. int    s_mark_far()
  610. {
  611.     if( !s_mark_start() )
  612.         return    FALSE;
  613.  
  614.         // now the current position is at the start of the small
  615.         // list matched, the anchor at the end. Try to extend the list.
  616.  
  617.     while( s_mark_further() );
  618.     return    TRUE;
  619. }
  620.  
  621. /************************************************************************
  622.  * Evaluate the mark (or the current s-expr) in PCS            *
  623.  ************************************************************************/
  624. void    s_eval_mark()
  625. {
  626.     int    tmp = create_buffer("*transit*", TRANSITNAME, 0 ), buf;
  627.     string    name;
  628.  
  629.     inq_names( name );
  630.  
  631.     if( !inq_marked() )
  632.     if( !s_mark_far() )
  633.         return;
  634.     copy();
  635.     buf = set_buffer( tmp );
  636.     paste();
  637.     write_buffer();
  638.     set_buffer( buf );
  639.     delete_buffer( tmp );
  640.     exit();
  641. }
  642.  
  643. /************************************************************************
  644.  * Evaluate the buffer (in PCS)                        *
  645.  ************************************************************************/
  646. void    s_eval_all()
  647. {
  648.     int    tmp = create_buffer("*transit*", TRANSITNAME, 0 ), buf;
  649.     string    name;
  650.  
  651.     inq_names( name );
  652.  
  653.     buf = set_buffer( tmp );
  654.     insert("(load \"");
  655.     insert( name );
  656.     move_abs( NULL, 1 );
  657.     translate("\\\\", "/", 1 );
  658.     end_of_line();
  659.     insert("\")\n");
  660.     write_buffer();
  661.     set_buffer( buf );
  662.     delete_buffer( tmp );
  663.     exit();
  664. }
  665.  
  666. /************************************************************************
  667.  * List all procedures in a dialog                    *
  668.  ************************************************************************/
  669. int    s_goto_line, s_goto_col;
  670.  
  671. int    s_menu_action( int event, ... )
  672. {
  673.     if( event == DIALOG_PICK_MENU )
  674.     {
  675.         string    text;
  676.  
  677.         get_parm( 2, text );
  678.         text = substr( text, index(text,";")+2 );
  679.         s_goto_line = atoi( substr(text,1,index(text," ")-1) );
  680.         text = substr( text, index(text," ")+1 );
  681.         s_goto_col = atoi( text );
  682.         _dialog_esc();
  683.     }
  684.     return    TRUE;
  685. }
  686.  
  687. void    s_list_proc()
  688. {
  689.     int    menu = create_buffer("Defines", NULL, 1 ), count, width = MINMENU;
  690.     
  691.     save_position();
  692.     s_goto_line = 0;
  693.     top_of_buffer();
  694.     for(;;)
  695.     {
  696.         string    buf;
  697.         int    line, col, oldbuf;
  698.  
  699.         if( !search_fwd("(define", NULL, 0 ) )
  700.         {
  701.             if( count )
  702.                 break;
  703.             else {
  704.                 error("No define found.");
  705.                 delete_buffer(menu);
  706.                 return;
  707.             }
  708.         } else    count++;
  709.  
  710.         next_char( search_fwd("(define[ \t\n]@[~ \t\n]", NULL, 0 ) - 2 );
  711.         if( read(1) == "(")
  712.             buf = read( search_fwd("(*)")-1 );
  713.         else    buf = read( search_fwd("*[) \t\n]")-2 );
  714.         inq_position( line, col );
  715.  
  716.         oldbuf = set_buffer( menu );
  717.         if( strlen(buf) > width )
  718.             width = strlen(buf);
  719.         if( width > MAXMENU )
  720.         {
  721.             width = MAXMENU;
  722.             buf = substr( buf, 1, MAXMENU );
  723.         }
  724.         insert( buf );
  725.         sprintf( buf, " ; %d %d\n", line, col );
  726.         insert( buf );
  727.         set_buffer( oldbuf );
  728.         message("%d defines...", count );
  729.     }
  730.  
  731.     count = set_buffer( menu );
  732.     prev_char();
  733.     delete_char();
  734.     top_of_buffer();
  735.     while( search_fwd(";") > 0 )
  736.     {
  737.         insert("\n");
  738.         move_rel( -1, width+1 );
  739.         delete_char();
  740.         end_of_line();
  741.     }
  742.     set_buffer( count );
  743.     restore_position();
  744.     
  745.     _process_menu( 32, 3, 32, 3, "", "", NULL, menu, "s_menu_action", TRUE );
  746.     delete_buffer( menu );
  747.     if( s_goto_line )
  748.     {
  749.         int    newtop;
  750.         inq_window_size( newtop, NULL );
  751.         newtop = s_goto_line - newtop/4;
  752.         move_abs( s_goto_line, s_goto_col );
  753.         set_top_left( newtop > 0 ? newtop : 1 );
  754.     }
  755. }
  756.  
  757. /************************************************************************
  758.  * Give some help on the package                    *
  759.  ************************************************************************/
  760. int    s_help_action(...)
  761. {
  762.     return    TRUE;
  763. }
  764.  
  765. void    s_help()
  766. {
  767.     _process_menu( 2, 21, 76, 2, "PCS package", "", "scheme.mnu", NULL, "s_help_action", TRUE );
  768. }
  769.  
  770. /************************************************************************
  771.  * Goto the next / previous word                    *
  772.  ************************************************************************/
  773. void    s_prev()
  774. {
  775.     prev_char(2);
  776.     search_back("{{[ \t,.'`()]|%}\\c[~ \t\n,.'`()]}|{[~()]\\c[()]}");
  777. }
  778.  
  779. void    s_next()
  780. {
  781.     if( search_fwd("{{[ \t,.'`()]|%}\\c[~ \t\n,.'`()]}|{[~()]\\c[()]}") <= 0 )
  782.         end_of_line();
  783. }
  784.  
  785. /************************************************************************
  786.  * Toggle mode                                *
  787.  ************************************************************************/
  788. void    s_toggle()
  789. {
  790.     s_mode = !s_mode;
  791.     message("PCS Package is %s", s_mode ? "on" : "off");
  792. }
  793.